<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="../vue.global.js"></script>
  </head>

  <body>
    <div id="app">
      <h3>劳资是{{name}}</h3>
      <ul>
        <todo-item v-for="item in todos" v-bind:hero="item"></todo-item>
      </ul>
    </div>

    <script>
      const TodoItem = {
        template:`
          <li>
            <h6>{{hero.name}}</h6>
            <span>{{hero.todo}}</span>
          </li>
        `,
        props:["hero"]
      };

      const TodoList = {
        data() {
          return {
            name: "父组件",
            todos: [
              { name: "黑旋风魁哥", todo: "杀到东京，夺了鸟位" },
              { name: "大阴人没卵用", todo: "先将目标的妻小劫上梁山" },
              { name: "庞大和尚鲁达", todo: "去那厮面门只一掌" },
            ],
          };
        },
        components: {
            TodoItem
        },
      };

      const app = Vue.createApp(TodoList);
      app.mount("#app");
    </script>
  </body>
</html>
